import axios from '@/utils/request'
// 频道

/**
 * 获取所有频道
 * @returns
 */
export const getAllChannels = () => {
  return axios({
    url: '/v1_0/channels',
    method: 'GET'
  })
}
/**
   * 获取用户频道
   * @returns promise
   */
export const getUserChannels = () => {
  return axios({
    url: '/v1_0/user/channels',
    method: 'GET'
  })
}

/**
   * 设置用户的频道（部分覆盖）
   * @param {*} channels 频道对象
   * @returns promise
   */
export const setUpChannel = (channels) => {
  return axios({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels
    }
  })
}
/**
   * 删除指定用户频道
   * @param {*} id 删除频道的id
   * @returns promise
   */
export const delChannels = (id) => {
  return axios({
    url: `/v1_0/user/channels/${id}`,
    method: 'DELETE'
  })
}
